home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Sound
/
MUImp3
/
MUImp3.mmp
< prev
next >
Wrap
Text File
|
2000-05-04
|
10KB
|
460 lines
/* */
parse arg name
options results
address command
'stack 50000'
if ~show('L',"rexxtricks.library") then call addlib('rexxtricks.library',0,-30,0)
option = word(name,1)
target = substr(name,length(option)+2)
prefs = 'envarc:MUImp3.prefs'
sorted = -2
TRUE = 1
FALSE = 0
if option = "GENRE" then do
address MUImp3
nr = value(word(target,1))
popslider id mpg attrs 0x8042ae3a nr
address command
'rx MUImp3.mmp CHAN 6'||nr
exit
end
if option = "DISABLE" THEN DO
ADDRESS MUImp3
GROUP id BUTT ATTRS 0x80423661 TARGET
exit
end
if option="ATTOF" then do
address MUImp3
list id song attrs 0x80421654
nr = result
list id song
temp = maketemp('t:')
call open('work',temp,'W')
do a = 0 to nr-1
address MUImp3
list id song pos a
line = result
list id song
if left(line,2)="ID" then call writeln('work','rx MUImp3.mmp TTOF' line)
end
call close('work')
address command
'execute' temp
'delete >nil:' temp
exit
end
if option="TTOF" then do
address MUImp3
l = target
if target = "" then do
list id song
l = result
list id song
end
if left(l,4)="FILE" then do
text id mes3 label "No CD-Track"
exit
end
call readfile(prefs,targ)
call readfile(makepath('projects',l),file)
temp = maketemp(targ.11)
nr = value(right(l,2))
com1 = 'cdda mute' targ.3 'track' nr 'file' temp
address command
'rx MUImp3.mmp MESSAGE Read Track' nr
'rx MUImp3.mmp DISABLE 1'
com1
'rx MUImp3.mmp ADDFILE' temp
call readfile(makepath('projects','FILE_'||filepart(temp)),line)
do a = 1 to 7
line.a = file.a
end
line.8 = temp
line.0 = 8
call writefile(makepath('projects','FILE_'||filepart(temp)),line)
address command
'rx MUImp3.mmp MESSAGE' Ready
'rx MUImp3.mmp REMOVE' l
'rx MUImp3.mmp DISABLE 0'
exit
end
if option="CONVALL" then do
address MUImp3
list id song attrs 0x80421654
nr = result
list id song
temp = maketemp('t:')
do a = 0 to nr-1
address MUImp3
list id song pos a
b = a + 1
line.b = result
line.b = 'rx MUImp3.mmp CONVERT' line.b
list id song
end
line.0 = nr
call writefile(temp,line)
address command
'execute' temp
'delete >nil:' temp
exit
end
if option="CONVERT" then do
address MUImp3
if target = "" then do
list id song
l = result
list id song
end
else l = target
call readfile(prefs,line)
call readfile(makepath('projects',l),file)
com = line.4
if line.5 = 1 then com = com '-c'
if line.6 = 1 then com = com '-o'
if line.7 = 1 then com = com '-r'
if line.8 = 1 then com = com '-x'
com = com '-b' line.9
if line.10 ~= "Auto" then do
if line.10 = "Stereo" then com = com '-s'
else com = com '-m'
end
com = com '-t' '"'file.1'"'
com = com '-a' '"'file.2'"'
com = com '-l' '"'file.3'"'
com = com '-y' '"'file.4'"'
com = com '-e' '"'file.5'"'
com = com '-g' '"'file.6'"'
nr = value(right(l,2))
temp2 = maketemp(line.11)
com1 = 'cdda mute' line.3 'track' nr 'file' temp2
temp = maketemp('t:')
call open('work',temp,'W')
if left(l,2)="ID" then do
com1 = 'run >nil: cdda mute' line.3 'track' nr 'file PIPE:MUImp3/500000/100'
com = com 'PIPE:MUImp3' '"'file.7'"'
call writeln('work','stack 500000')
call writeln('work','rx MUImp3.mmp MESSAGE Read Track '||nr)
call writeln('work',com1)
call writeln('work','rx MUImp3.mmp MESSAGE Convert Track '||nr)
call writeln('work',com)
call writeln('work','rx MUImp3.mmp SONGUP' l)
call writeln('work','delete >nil:' temp2)
call writeln('work','rx MUImp3.mmp MESSAGE Ready')
end
else do
com = com '"'file.8'"' '"'file.7'"'
call writeln('work','stack 500000')
call writeln('work','rx MUImp3.mmp MESSAGE Convert File '||file.8)
call writeln('work',com)
if upper(right(file.8,4))=".TMP" then call writeln('work','delete >nil: '||file.8)
call writeln('work','rx MUImp3.mmp SONGUP' l)
call writeln('work','rx MUImp3.mmp MESSAGE Ready')
end
call close('work')
address command
'rx MUImp3.mmp DISABLE 1'
'execute >nil:' temp
'delete >nil:' temp
'delete >nil:' temp2
'rx MUImp3.mmp DISABLE 0'
exit
end
if option="MESSAGE" then do
address MUImp3
text id mes3 label target
exit
end
if option="SONGUP" then do
address command
'delete >nil:' makepath('projects',target)
address MUImp3
list id song remove string target
list id song
exit
end
if option="REMOVE" then do
line = target
address MUImp3
if target="" then do
list id song
line = result
end
if line = "" then exit
list id song remove string line
list id song
address command
'delete >nil:' makepath('projects',line)
exit
end
if option="SHOWINFO" then do
call readfile(makepath('projects',target),line)
address MUImp3
text id mes2 label target
string id mpt content line.1
string id mpr content line.2
string id mpa content line.3
string id mpy content line.4
string id mpe content line.5
popslider id mpg attrs 0x8042ae3a line.6
exit
end
if option="ADDFILE" then do
address MUImp3
if target="" then do
text id mes3 label "Drop one AIFF-16Bit File on Projects-List"
exit
end
call readfile(prefs,targ)
line.0 = "FILE_"||filepart(target)
line.1 = filepart(target)
line.2 = ""
line.3 = ""
line.4 = right(date('N'),4)
line.5 = 'MUImp3' filepart(target)
line.6 = "13"
line.7 = makepath(targ.12,filepart(remsig(target)))
line.7 = makesuffix(line.7,'mp3',R)
line.8 = target
if ~exists('projects') then do
address command
'makedir >nil: projects'
address MUImp3
end
a = line.0
line.0 = 8
call writefile(makepath('projects',a),line)
list id song insert nodup pos sorted string a
list id song
exit
end
if option="ADDCD" then do
address MUImp3
text id mes1
cdid = result
if ~index(cdid,'ID') then do
address command
'rx MUImp3.mmp GETID'
address MUImp3
text id mes1
cdid = result
end
call readfile(prefs,line)
slider id mint
min1 = result
slider id maxt
max1 = result
if ~exists('projects') then do
address command
'makedir >nil: projects'
address MUImp3
end
do a = min1 to max1
file.0 = cdid||"-"||overlay(a,'00',3-length(a))
title0 = ""
title.1 = cdid
c = a + 2
title.c = file.0
say line.13||cdid
if exists(line.13||cdid) then do
call readfile(line.13||cdid,title)
end
file.1 = title.c
file.2 = title.1
file.3 = title.2
file.4 = ""
file.5 = 'MUImp3' file.0
file.6 = "13"
file.7 = makepath(line.12,remsig(file.1)||'.mp3')
f = file.0
file.8 = ""
file.0 = 8
call writefile('projects/'||f,file)
address MUImp3
list id song insert nodup pos sorted string f
list id song
end
exit
end
if option="SCHECK" then do
address MUImp3
slider id mint
min1 = result
slider id maxt
max1 = result
if min1 > max1 then slider id maxt attrs 0x8042ae3a min1
if max1 < min1 then slider id mint attrs 0x8042ae3a max1
exit
end
if option="GETID" then do
file = "ID"
temp = maketemp('t:')
call readfile(prefs,line)
address command
'cdda mute list' line.3 '>'||temp
call readfile(temp,track)
'delete >nil:' temp
nr = track.0 - 2
file = file||overlay(nr,'00',3-length(nr))||'0'
if nr > 1 then do
file1 = d2x(value(word(track.2,6))+value(word(track.3,6)))
if word(track.2,2)>0 then file1 = d2x(value(word(track.2,6))+value(word(track.3,6)+value(word(track.2,2))))
if length(file1)<5 then file1=overlay(file1,'00000',6-length(file1))
end
else file1 = '00000'
file = file||file1||'0'
a = nr + 2
file1 = d2x(value(word(track.a,6)))
if word(track.2,2)>0 then file1 = d2x(value(word(track.2,2)+word(track.a,6)))
file = file||file1
address MUImp3
text id mes1 label file
slider id mint attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a 1
slider id maxt attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a nr
exit
end
if option="INIT" then do
if ~exists(prefs) then do
address MUImp3
cycle id bitr label "128"
address command
'rx MUImp3.mmp SAVE'
end
address command
'rx MUImp3.mmp LOAD'
temp = maketemp('t:')
if ~exists('projects') then 'makedir projects'
'list projects lformat %s >'||temp
call readfile(temp,line)
'delete >nil:' temp
address MUImp3
do a = 1 to line.0
list id song pos sorted insert nodup string line.a
end
call readfile('Genres',line)
do a = 1 to line.0
if line.a ~="" then do
line = value(substr(line.a,1,3)) substr(line.a,5)
list id genr pos sorted insert nodup string line
end
end
exit
end
if option="LOAD" then do
call readfile(prefs,line)
call setenv(CDDA_DEVICE,line.1)
call setenv(CDDA_UNIT,line.2)
address MUImp3
string id cdev content line.1
slider id cdun attrs 0x8042ae3a line.2
cycle id plan label line.3
popasl id path content line.4
check id copy attrs 0x8042654b line.5
check id orig attrs 0x8042654b line.6
check id crc attrs 0x8042654b line.7
check id max attrs 0x8042654b line.8
cycle id bitr label line.9
cycle id ster label line.10
popasl id temp content line.11
popasl id dest content line.12
popasl id cdid content line.13
exit
end
if option="SAVE" then do
address MUImp3
string id cdev
line.1 = result
slider id cdun
line.2 = result
cycle id plan
line.3 = result
popasl id path
line.4 = result
check id copy
line.5 = result
check id orig
line.6 = result
check id crc
line.7 = result
check id max
line.8 = result
cycle id bitr
line.9 = result
cycle id ster
line.10 = result
popasl id temp
line.11 = result
popasl id dest
line.12 = result
popasl id cdid
line.13 = result
call setenv(CDDA_DEVICE,line.1)
call setenv(CDDA_UNIT,line.2)
line.0 = 13
call writefile(prefs,line)
exit
end
if option = "CHAN" then do
address MUImp3
text id mes2
line = result
if line = "" then exit
nr = left(target,1)
target = right(target,length(target)-1)
call readfile(makepath('projects',line),file)
file.nr = target
if nr = 1 then do
linea = pathpart(file.7)
lineb = remsig(target)||".mp3"
linec = makepath(linea,lineb)
file.7 = linec
end
call writefile(makepath('projects',line),file)
exit
end
exit
remsig:
parse arg rems
remt = translate(rems,"_-","/~#?*||'","_")
return remt
maketemp:
parse arg path
a = 1
temp = makepath(path,'MUImp3.1.tmp')
do while exists(temp)
a = a + 1
temp = makepath(path,'MUImp3.'a'.tmp')
end
call open('work',temp,'W')
call close('work')
return temp